<template>
	<view class="cus-settle-container">
		<label class="radio" @click="allChecked">
			<radio color="#c00000" :checked="isFullChecked"/><text>全选</text>
		</label>
		<view class="amount-box">
			合计：<text class="amount">￥{{totalPrice}}</text>
		</view>
		<view class="settle-box">
			结算({{checkedCount}})
		</view>
	</view>
</template>

<script>
	import { mapGetters, mapMutations} from 'vuex'
	export default {
		name:"cus-settle",
		data() {
			return {
				
			}
		},
		computed: {
			...mapGetters('m_cart', ['checkedCount', 'total', 'totalPrice']),
			// 是否全选
			isFullChecked() {
				return this.total === this.checkedCount
			}
		},
		
		methods: {
			...mapMutations('m_cart', ['updateAllRadio']),
			allChecked() {
				// console.log(this.isFullChecked);
				this.updateAllRadio(!this.isFullChecked)
			}
		}
	}
</script>

<style lang="scss">
.cus-settle-container {
	position: fixed;
	left: 0;
	bottom: 0;
	width: 100%;
	height: 50px;
	background-color: #fff;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-left: 5px;
	.radio {
		display: flex;
		align-items: center;
		
	}
	.amount-box {
		.amount {
			color: #c00000;
		}
	}
	.settle-box {
		background-color: #c00000;
		min-width: 100px;
		color: #fff;
		height: 50px;
		line-height: 50px;
		text-align: center;
		padding: 0 10px;
	}
}
</style>